#include <cstdio>
#include <cstdlib>
#include <cassert>

struct list
{
	int val;
	list* next;

	list ()
	{
		val = 0;
		next = 0;
	}

	list (int v)
	{
		val = v;
		next = 0;
	}
};

void add (list *&head, list *elem)
{
	elem->next = head;
	head = elem;
}

void test (int STEP_COUNT, int ELEM_COUNT)
{
	for (int i = 0; i < STEP_COUNT; i++)
	{
		list *head = 0;
		for (int j = 0; j < ELEM_COUNT; j++)
			add(head, new list(rand() + j));
	}
}

int main (int argc, char *argv[])
{
	assert(argc == 3);
	int STEP_COUNT, ELEM_COUNT;

	sscanf (argv[1], "%d", &STEP_COUNT);
	sscanf (argv[2], "%d", &ELEM_COUNT);

	test(STEP_COUNT, ELEM_COUNT);

	return 0;
}
